/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package centralehotel.modele;

import centralehotel.modele.Chambre;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mathieu
 */
@Entity
@Table(name = "type_chambre")
@NamedQueries({@NamedQuery(name = "TypeChambre.findByIdTypeChambre", query = "SELECT t FROM TypeChambre t WHERE t.idTypeChambre = :idTypeChambre"), @NamedQuery(name = "TypeChambre.findByLibelle", query = "SELECT t FROM TypeChambre t WHERE t.libelle = :libelle")})
public class TypeChambre implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "id_type_chambre", nullable = false)
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Integer idTypeChambre;
    @Column(name = "libelle")
    private String libelle;
    @OneToMany(mappedBy = "typeChambre")
    private Collection<Chambre> chambreCollection;

    public TypeChambre() {
    }

    public TypeChambre(Integer idTypeChambre) {
        this.idTypeChambre = idTypeChambre;
    }

    public Integer getIdTypeChambre() {
        return idTypeChambre;
    }

    public void setIdTypeChambre(Integer idTypeChambre) {
        this.idTypeChambre = idTypeChambre;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    public Collection<Chambre> getChambreCollection() {
        return chambreCollection;
    }

    public void setChambreCollection(Collection<Chambre> chambreCollection) {
        this.chambreCollection = chambreCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTypeChambre != null ? idTypeChambre.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypeChambre)) {
            return false;
        }
        TypeChambre other = (TypeChambre) object;
        if ((this.idTypeChambre == null && other.idTypeChambre != null) || (this.idTypeChambre != null && !this.idTypeChambre.equals(other.idTypeChambre))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "centralehotel.exception.TypeChambre[idTypeChambre=" + idTypeChambre + "]";
    }

}
